<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%String path = request.getContextPath() ;%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %> 
<%@ taglib uri="/WEB-INF/tld/ui.tld" prefix="ui" %> 
<!DOCTYPE html>
<html lang="zh-CN" >
<head>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>汽贸城管理列表</title>
<jsp:include page="../../import.jsp" flush="true" />
</head>
<body class="iframeBody">
<div class="Wrapper">
<div class="searchArea">
    <form id="searchBar">
        <div class="fieldset1 clearFix">
            <div class="fieldBox">
                <div class="label">名称</div>
                <div class="field">
                    <input name="atNm" id="atNm" type="text" class="ui-textbox" value="">
                </div>
            </div>
            <div class="fieldBox">
                <div class="label">状态</div>
                <div class="field">
                    <select name="status" id="status" data-value=" ">
						<option value=" " seleted>请选择</option>
						<c:forEach items="${searchStatusList}" var="kv">
							<option value="${kv.key }">${kv.value }</option>
						</c:forEach>
					</select>
                </div>
            </div>
            <div class="fieldBox">
                <div class="label">到期时间范围</div>
                <div class="field">
                    <input name="beginDt" id="beginDt" type="text" class="ui-datepicker" value="" >
                     - 
                    <input name="endDt" id="endDt" type="text" class="ui-datepicker" value="" >
                </div>
            </div>
            
            <div class="clearFix"></div>
            <div class="btnsBox formBtns notRight">
                <span id="searchBtn" class="sq-button-round">查询</span>
                <span id="clearBtn" class="sq-button-round">清空</span>
                <span id="saveBtn" class="sq-button sq-button-round" onclick="add()">新增</span>
               <!--  <span id="exportBtn" class="sq-button-round" onclick="exportBook();">导出Excel</span> -->
                <input id="resetBtn" type="reset" value="重置" class="l-button l-button-reset Hide"/>
            </div>
        </form>
    </div>
    <div class="sqPanel" style="margin-bottom: 0;">
	    <div class="sqPanel_head" style="float:right;">
	        <table class="table_full">
	            <tr>
	                <td style="color: blue">
	                	<b><i class="ico_flasher_blue"></i></b>合同到期前30天提醒
	                </td>
	                <td style="color: red">
	                	<b><i class="ico_flasher"></i></b>合同已经超期提醒
	                </td>
	            </tr>
	        </table>
	    </div>
	    <div class="sqPanel_body">
	        <div id="ligergrid1" class="sq-grid"></div>
	    </div>
	</div>
</div>
<!-- <div id="ligergrid1" class="sq-grid"></div> -->


</body>
<script type="text/javascript">
	var grid = null;
	var _bookTypCd = AuditConstant.AUD_BSC_BOOK_TYP_CD;
	$(function () {
	    $("#ligergrid1").ligerGrid({
	    	url: '<%=path%>/atc/atcBscInfo/initList.do',
	    	method : 'get',
	    	parms:{bookTypCd:_bookTypCd},
	        columns: [
	            { display: '<span class="sqiconfont sqicon-tishi c_sqYellow gridTip" title="合同提醒"></span>', name: 'bookCode', width: 30,
	            	render: function (rowdata, rowindex, value) {
	            		var ico_flasher_r='<i class="ico_flasher"></i>'
	            		var ico_flasher_b='<i class="ico_flasher_blue"></i>'
	            		var h = '';
				        if (StringUtils.isNotEmpty(rowdata.isExpireRed) && rowdata.isExpireRed == 1){
				        	h = ico_flasher_r;
				        }
				        if (StringUtils.isNotEmpty(rowdata.isExpireBlue) && rowdata.isExpireBlue == 1){
				        	h = ico_flasher_b;
				        }
				        return h;
				    }	
	            },
	            { display: '名称', name: 'atNm', width: 100,
	            	render: function (rowdata, rowindex, value){
	            		var h='<a href="javascript:showDetail(';
	            		h+="'"+rowdata.id+"'";
	                    h+=')">'+rowdata.atNm+'</a>';
	                	return h;
	            	}		
	            },
	            { display: '地址', name: 'atAddr', width: 160},
	            { display: '所在城市', name: 'city', width: 120,
	            	render: function (rowdata, rowindex, value) {
	            		var h = rowdata.rgnPrCdNm +'-'+rowdata.rgnCyCdNm;
	            		return h;
	            	},
	            },
	            { display: '联系人', name: 'rlNm', width: 100},
	            { display: '联系人电话', name: 'mp', width: 120},
	            { display: '合同有效期', name: 'beginDt', width: 170,
	            	render:function (rowdata, index, value){
	            		var endDt = "";
	            		var startDt = "";
	            		if(null != rowdata.endDt){
	            			var date = new Date(rowdata.endDt);
	            			endDt = DateUtils.formatDate(date, 'yyyy.MM.dd');
	            		}
	            		if(null != value){
	            			var date = new Date(value);
	            			startDt = DateUtils.formatDate(date, 'yyyy.MM.dd');
	            		}
	            		return startDt+"-"+endDt;
	            	}	
	            },
	            { display: '状态', name: 'statusNm', width: 50},
	            { display: '操作', name: '', width: 100,
	            	render:function (rowdata, index, value){
	            		var g='<a class="sq-button-hasicon" href="javascript:change(';
	            		g+="'"+rowdata.id+"'";
	                    g+=')"><i class="sqBtnIco_4"></i>修改</a>';
	            		return g;
	            	}	
	            },
	        ],
	        pageSize:10,
	        root:'rows',
	        record:'total',
	        hideLoadButton : true,
	        width: '100%',
	        height:'100%',
	        heightDiff:-2,
	        checkbox:true,
	        isScroll: true,
	        rownumbers:true,
	        onAfterShowData: function () {
	            $(".gridTip").grid_ligerTip();
	            SetIframe_height ();
	        }
	    });
	    grid = liger.get("ligergrid1");
	    grid.setHeight(100);
	    $("#searchBar").ligerForm();
	
	    $("#searchBtn").click(function(event) {
	         var form = new liger.get("searchBar");
	         var data = form.getData();
	         for (name in data){
	            grid.setParm(name,data[name]);
	         };
	         if($("#endDt").val() != "" && $("#startDt").val()>$("#endDt").val()){
	        	 $.ligerDialog.SQalert({content: "添加日期(起)不能大于添加日期(止)" , SQ_type: "warning" });
	        	 return;
	         }
	         grid.reload();
	    });
	    $("#clearBtn").click(function(event) {
	        $("#resetBtn").click();  //重置 input-text
	        var form = liger.get("searchBar");
	        form.setData({  //重置select等特殊表单
	            "status": " "
	        });
	    });
	    
	    $("#pageloading").hide();
	    
	});
	 //新增数据
	var callback = function () {
		grid.reload();
    };
    //修改
	function change(_id){
		if(!_id){
			return;
		}
		Add_navTab('autoTrade_2'+_id,'修改汽贸城','<%=path%>/atc/atcBscInfo/toAddPage.do?id='+_id, callback);
	}
	//新增
	function add(){
		Add_navTab('autoTrade_3','新增汽贸城','<%=path%>/atc/atcBscInfo/toAddPage.do', callback);
	}
	function showDetail(_id){
		Add_navTab('autoTrade_4'+_id,'汽贸城详情','<%=path%>/atc/atcBscInfo/toAtcBscInfoDetailPage.do?atcId='+_id, callback);
	}
</script>

</html>